package com.atguigu.Spring5.pojo;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @Author xiao hu die
 * @Date 2022/3/30 22:51
 * @Version 1.0
 */
public class PeopleProxy implements InvocationHandler {
  private Object object;
 public PeopleProxy(Object  object) {
  this.object =object;
 }

 @Override
 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
  System.out.println("方法之前执行。。。。。"+method.getName()+"传递的参数:"+ Arrays.toString(args));
  Object invoke = method.invoke(object, args);
  System.out.println("方法之后执行。。。。。"+object.toString());
  return invoke;
 }
}
